//
// Created by ct on 2021/9/21.
//
#include <stdio.h>

#include "ext2_fs.h"

//// 接口方法实现集合
//fs_methods_t ext2_methods = {
//        .open_file = (open_file_fn)ext2_open_file,
//        .read_file = (read_file_fn)ext2_read_file,
//};
//
//// 服务实例
//ext2_fs_t g_ext2_fs;


file_system_interface ext2_init(fs_methods_t*  ext2_methods,ext2_fs_t * g_ext2_fs ) {
    // init g_ext2_fs struct ....
    // ....


    file_system_interface fsi = { .pfs = g_ext2_fs, .pmethods = ext2_methods };
  //  int ret = register_file_system("ext2", fsi);
    return fsi;
  //  return ret;
}

int ext2_open_file(ext2_fs_t* pfs, const char* path, int flags) {
    printf("AAAAAAAA %s  \n",pfs->a);
    printf("open file %s -- %d \n",path,flags );
    return 0;
}


int ext2_read_file(ext2_fs_t* pfs, int fd, char* buf, int len) {
    // ....

    printf("read file  %d \n",fd );
    for (int i = 0; i < len; ++i) {
        buf[i] = '1';
        printf("buf [%d] = 1 ",i );
    }
    printf("现在 buf 是：%s",buf);
    return 0;
}
